package com.huanzhidadi.springsecurity.controller;

import com.huanzhidadi.springsecurity.model.BaseResultVO;
import com.huanzhidadi.springsecurity.model.LoginUser;
import com.huanzhidadi.springsecurity.model.User;
import com.huanzhidadi.springsecurity.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("auth")
public class AuthController {

    @Autowired
    private LoginService loginService;

    @PostMapping("login")
    public BaseResultVO login(@RequestBody LoginUser loginUser) {

        return loginService.login(loginUser);
    }

    @PostMapping("logout")
    public BaseResultVO logout() {

        return loginService.logout();
    }
}
